use combined_county

tabstat democrat2008, stat(sum) format(%12.0gc)
tabstat totalvotes2008 , stat(sum) format(%12.0gc)

count if gini>1 & gini<.
count if fraction_religious>1 & fraction_religious<.

replace gini=0.81918 if gini>1 & gini<.
replace fraction_religious=1 if fraction_religious>1 & fraction_religious<.

replace mobility=mobility/100

gen share_dem2008=democrat2008/totalvotes2008

gen upward_prob= prob_C4P1+ prob_C5P1
gen logincome=log(hincome_per_capita)

sum share_dem2008 hincome_per_capita gini mobility upward_prob fraction_black fraction_foreign_born fraction_religious share_manufacturing unemployment_rate county_pop

reg share_dem2008 logincome gini fraction_black fraction_foreign_born fraction_religious share_manufacturing unemployment_rate logdensity  i.state_id [w=county_pop], robust
reg share_dem2008 logincome gini mobility fraction_black fraction_foreign_born fraction_religious share_manufacturing unemployment_rate logdensity  i.state_id [w=county_pop], robust
reg share_dem2008 logincome gini upward_prob fraction_black fraction_foreign_born fraction_religious share_manufacturing unemployment_rate logdensity  i.state_id [w=county_pop], robust


